Making an update to an Annotation is as simple as POSTing JSON to the id
of the annotation, containing the changed annotation.
However, you must provide the ETag
using the If-Match
header.
For example if we did a GET
.
HTTP/1.1 200ETag: W/“741c3b063c0345ce862a62cf429b2a4b” \<\<\<\< ETag HERELink: \<http://www.w3.org/ns/ldp\#Resource\>; rel="type"Allow: PUT,GET,OPTIONS,HEAD,DELETEVary: AcceptMemento-Datetime: Sun, 20 May 2018 19:37:32 UTC \#\# IGNORE THIS FOR NOWContent-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld";charset=UTF-8Transfer-Encoding: chunkedDate: Sun, 20 May 2018 19:56:18 GMTConnection: close{"@context" : "http://www.w3.org/ns/anno.jsonld","id" : "http://localhost:8080/annotation/w3c/my-container/foo-bar","type" : "Annotation","body" : {"type" : "TextualBody","value" : "This one has a SLUG, so I know what id the annotation will have."},"target" : "http://www.example.com/index.html"}
A PUT to update that annotation would look like
PUT /annotationw3c/my-container/ HTTP/1.1Accept: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"Content-Type: application/ld+json;If-Match: 741c3b063c0345ce862a62cf429b2a4bHost: localhost:8080Connection: closeUser-Agent: Paw/3.1.5 (Macintosh; OS X/10.13.4) GCDHTTPRequestContent-Length: 281{"@context": "http://www.w3.org/ns/anno.jsonld","type": "Annotation","body": {"type": "TextualBody","value": "This one has a SLUG, so I know what id the annotation will have. And I have changed its content."},"target": "http://www.example.com/index.html"}
HTTP/1.1 200ETag: W/"3b6f03d78812a166ce6b43e415b58e29"Link: \<http://www.w3.org/ns/ldp\#Resource\>; rel="type"Link: \<http://localhost:8080/annotation/w3c/services/history/my-container/foo-bar/1\>; rel="prev memento"; datetime="Sun, 20 May 2018 19:37:32 UTC"Allow: PUT,GET,OPTIONS,HEAD,DELETEVary: AcceptMemento-Datetime: Sun, 20 May 2018 20:01:04 UTCContent-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld";charset=UTF-8Transfer-Encoding: chunkedDate: Sun, 20 May 2018 20:01:05 GMTConnection: close{"@context" : "http://www.w3.org/ns/anno.jsonld","id" : "http://localhost:8080/annotation/w3c/my-container/foo-bar","type" : "Annotation","body" : {"type" : "TextualBody","value" : "This one has a SLUG, so I know what id the annotation will have. And I have changed its content."},"target" : "http://www.example.com/index.html"}